#-*- coding: utf-8 -*-
from django.db import models

class salt_api_log(models.Model):
    user_name = models.CharField(max_length="20", verbose_name=u"用户名")
    minions = models.CharField(max_length="2048", verbose_name=u"主机名")
    jobs_id = models.CharField(max_length="40", verbose_name=u"job", blank=True, null=True,)
    stalt_type = models.CharField(max_length="20", verbose_name=u"操作类型")
    salt_len_node = models.IntegerField(max_length="20", verbose_name=u"多少台主机执行")
    stalt_input = models.CharField(max_length="100", blank=True, null=True, verbose_name=u"命令")
    api_return = models.TextField(verbose_name=u"执行记录")
    log_time = models.DateTimeField(auto_now=True, verbose_name=u"操作时间")

    class Meta:
        verbose_name = u"salt操作日志"
        verbose_name_plural = verbose_name
        db_table = 'salt_api_log'

class salt_node_list(models.Model):
    minions = models.CharField(max_length="2048", verbose_name=u"主机名")
    status = models.IntegerField(max_length="2", verbose_name=u"是否以上报")
    key_status = models.IntegerField(max_length="4", verbose_name=u"节点接受状态")
    class Meta:
        verbose_name = u"salt节点"
        verbose_name_plural = verbose_name
        get_latest_by = 'status'
        db_table = 'salt_node_list'
